﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Runtime.Serialization;
using Se.Framework.Common.Data;

namespace Trust.Casas.Model.Entities
{
    [Table("UserDetail")]
    [DataContract]
    public class UserDetail : AuditableEntity, IGenericEntity
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public int UserId { get; set; }

        [DataMember]
        [StringLength(100)]
        public string FirstName { get; set; }

        [DataMember]
        [StringLength(100)]
        public string LastName { get; set; }
                
        [ForeignKey("UserId")]
        [DataMember]
        public virtual User User { get; set; }

        public object GenericId
        {
            get
            {
                return Id;
            }
        }

        public override string ToString()
        {
            return string.Format("{0} {1}", FirstName, LastName);
        }
    }
}